package com.queming.music.mapper;

import com.queming.core.mapper.FileMapper;
import com.queming.core.mapper.MapperInterface;
import com.queming.music.dto.ArtistCreateRequest;
import com.queming.music.dto.ArtistDto;
import com.queming.music.dto.ArtistUpdateRequest;
import com.queming.music.entity.Artist;
import com.queming.music.vo.ArtistVo;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;


/**
 * @author chencidiao
 * @date 2022/05/07 13:55
 **/

@Mapper(componentModel = "spring" ,uses = {FileMapper.class,MusicMapper.class},nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface ArtistMapper extends MapperInterface<Artist,ArtistDto> {

    @Mapping(source = "photoId", target = "photo.id")
    ArtistDto toDto(ArtistCreateRequest artistCreateRequest);
    ArtistDto toDto(ArtistUpdateRequest artistUpdateRequest);

    ArtistVo toVo(ArtistDto artistDto);
}
